const Router = require("@koa/router");
const router = new Router();
const {
  updateStaff,
  addStaff,
  deleteStaff,
  queryAllData
} = require('../controller/staff')

router.get("/getAllStaff", async (ctx) => {
  ctx.body = await queryAllData(ctx.request.body)
});
router.post("/getAllStaff", async (ctx) => {
  ctx.body = await queryAllData(ctx.request.body)
});
// 增
router.post("/addStaff", async (ctx) => {
  ctx.body = await addStaff(ctx.request.body)
});
// 改
router.post("/updateStaff/:id", async (ctx, next) => {
  ctx.body = await updateStaff(ctx.request.body, ctx.params.id)
});
// 删除
router.delete("/delete/:id", async (ctx, next) => {
  ctx.body = await deleteStaff(ctx.params.id)
});
module.exports = router;
